from django.shortcuts import render,redirect
from django.http import HttpResponse

from App.models import *
# Create your views here.

def index(request):
    # pass
    return render(request,'index.html')

def uer_list(request):
    # 1.查询所有用户
    users = UserModel.objects.all()
    return render(request,'user_list.html',{'users':users})
def user_detail(request, user_id):
    # pass
    print("user_id:",user_id)
    user = UserModel.objects.get(pk=user_id)
    return render(request, 'user_detail.html', {'user': user})

def user_ab_view(request,a,b):
    return HttpResponse(f'a:{a}-b:{b}')
def my_redirect(request):
    # return redirect('https://cn.bing.com/')
    return redirect('/user/userlist/')